import { fileURLToPath, URL } from 'node:url'

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueDevTools from 'vite-plugin-vue-devtools'
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
import path from "path"
// https://vite.dev/config/
export default defineConfig({
  plugins: [
    vue(), 
    // svg图标配置
    createSvgIconsPlugin({
      // 指定需要缓存的图标文件夹
      iconDirs:[path.resolve(process.cwd(),'src/assets/icons')],
      // 指定symbolld格式
      symbolId: 'icon-[dir]-[name]' 
    }),
    vueDevTools(),
  ],
   // 服务器端选项
   server: {
    // 测试数据代理
    proxy: {
      '/api': {
        // target: "http://192.168.31.219:9000",
        target:'http://192.168.31.142:9000',
        rewrite: (path) => path.replace(/^\/api/, '')
      },      
    }
  },
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url)),
    },
  },
})
